﻿// ParseLib - An open source library for natural language processing.
// Copyright (C) Kais Dukes, 2012. E-mail: kais@kaisdukes.com
// http://parselib.org

namespace ParseLib.Text
{
    public class ForwardReader
    {
        protected string _text;
        protected int _position;

        public ForwardReader()
        {
        }

        public ForwardReader(string text)
        {
            Text = text;
        }

        public string Text
        {
            get { return _text; }
            set
            {
                _text = value;
                _position = 0;
            }
        }

        public char Peek()
        {
            return _text[_position];
        }

        public char Read()
        {
            return _text[_position++];
        }

        public bool End
        {
            get { return _position >= _text.Length; }
        }
    }
}
